package data;

import org.jdom.Element;


public abstract class Data
{
	private String id;
	
	public Data(String id)
	{
		if(id == null)
			throw new IllegalArgumentException("no null-values allowed.");
		
		this.id = id;
	}
	

	public Data(Element elem) throws Dataexception
	{
		if(elem == null)
			throw new IllegalArgumentException("no null-values allowed");
		
		this.id = elem.getChildText("id");
		
		if(this.id == null)
			throw new Dataexception("ID was not found in Element");
	}
	
	public boolean equals(Object obj)
	{
		if(obj instanceof Data && ((Data)obj).getID() == getID())
			return true;
		else
			return false;
	}
	
	public String getID()
	{
		return this.id;
	}
	
}
